<?php
namespace app\index\model;

use think\Exception;
use think\Model;

class Order extends Model{
     public static function   orderListInfo($id){
         $list=Order::alias('o')
             ->where('payment_id','=',$id)
             ->field('o.*,os.order_status')
             ->join('ecm_order_status os','os.status_id=o.status')
             ->select()->toArray();
            return $list;
         }

 public static function   orderListAddInfo($order){
     try{
       $rt=Order::insert([
           'order_sn'=>$order['order_sn'],
           'buyer_id'=>$order['id'],
           'buyer_name'=>$order['name'],
           'buyer_tel'=>$order['tel'],
           'sheng'=>$order['sheng'],
           'city'=>$order['city'],
           'quyu'=>$order['quyu'],
           'status'=>11,
           'add_time'=>$order['add_time'],
           'payment_id'=>$order['uid'],
           'payment_name'=>$order['uname'],
           'goods_name'=>$order['goods_name'],
           'goods_num'=>$order['goods_num'],
           'goods_amount'=>$order['goods_amount'],
           'order_amount'=>$order['order_amount'],
           'goods_vip'=>$order['goods_vip'],
           'goods_image'=>$order['goods_image'],
       ]);
     }catch (Exception $e){
         $rt=false;
     }
       return $rt;

     }


      public static function   orderListFindInfo($get){
         $list=Order::alias('o')
             ->field('o.*,os.order_status,c.name as sname,cc.name as cname,ccc.name as qname')
             ->where('o.order_id','=',$get['id'])
             ->join('ecm_order_status os','o.status = os.status_id')
             ->join('ecm_china_city c','c.id = o.sheng')
             ->join('ecm_china_city cc','cc.id = o.city')
             ->join('ecm_china_city ccc','ccc.id = o.quyu')->find()->toArray();
          return $list;

          }





}